package Test;

import com.chiffoyqc.nbiot.CmdProcess;
import com.chiffoyqc.nbiot.ProtocolAdapterImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

import java.util.Arrays;
import java.util.Calendar;

/**
 * Created by Administrator on 2018/1/11.
 * 3D 72 01 00 01 1616 23
 */
public class Test {



    public static void main(String[] args) {

        try {
            ObjectMapper mapper = new ObjectMapper();
            ObjectNode root = mapper.createObjectNode();

            root.put("identifier",123);
            root.put("msgType","cloudReq");
            root.put("serviceId","DeviceData");
            root.put("mid",2016);
            root.put("cmd","SEND_COMMAND");
            root.put("hasMore",0);

            ObjectNode child = mapper.createObjectNode();
            child.put("commandStr","0001AA");
            root.set("paras",child);

            System.out.println(root.toString());

            CmdProcess cmdProcess = new CmdProcess(root);
            byte[] byteNode = cmdProcess.toByte();

            System.out.println(Arrays.toString(byteNode));





        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
